﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Unity;
using Baosight.Platform.Core.ServiceModel;
using Baosight.Platform.Core.UI.Controls;
using Baosight.Platform.Core.UI;
using Baosight.Platform.Core;
using Baosight.ZNH.ZMCommon;
using Telerik.Windows.Controls;
using Baosight.ZNH.ZMCommon.ChildWindows;
using Telerik.Windows.Controls.GridView;

namespace Baosight.ZNH.ZMCA.UI
{
    public partial class ZMCA49 : EFViewCmes
    {
        public ZMCA49()
        {
            InitializeComponent();
            this.Loaded+=new RoutedEventHandler(ZMCA49_Loaded);
        }
        private void ZMCA49_Loaded(object sender, RoutedEventArgs e)
        {
            //传递查询条件，显示查询结果

            ResultInfo.Refresh();

        }

        public override void Initialize(EIInfo initData)
        {
            initData.AddBlock(getProblemType());
           base.Initialize(initData);
            if (initData.Attributes.ContainsKey("fdKeyId"))
            {
                this.fdKeyId.Value = Convert.ToString(initData.Attributes["fdKeyId"]);
            }
            if (initData.Attributes.ContainsKey("fdProblemTypeId"))
            {
                this.fdProblemTypeId.Value = Convert.ToString(initData.Attributes["fdProblemTypeId"]);
            }
        }

        /// <summary>
        /// 构造问题类型的block
        /// </summary>
        /// <returns></returns>
        public EIBlock getProblemType()
        {
            EIBlock block = new EIBlock("ProblemType");

            EIColumn column = new EIColumn();
            column.Name = "fdProblemType";
            column.SetTypeLabel("C");
            block.AddColumn(column);

            column = new EIColumn();
            column.Name = "fdProblemTypeId";
            column.SetTypeLabel("C");
            block.AddColumn(column);

            List<EIRow> _list = new List<EIRow>();
            EIRow row = new EIRow();
            row.Add("fdProblemType", "生产问题");
            row.Add("fdProblemTypeId", "1");
            _list.Add(row);

            row = new EIRow();
            row.Add("fdProblemType", "安全隐患");
            row.Add("fdProblemTypeId", "2");
            _list.Add(row);

            row = new EIRow();
            row.Add("fdProblemType", "安全三违");
            row.Add("fdProblemTypeId", "3");
            _list.Add(row);

            block.AddRows(_list);
            return block;
        }

    }
}
